using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace timer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            backgroundWorkerCheckWS.DoWork += new DoWorkEventHandler(backgroundWorkerCheckWS_DoWork);
            backgroundWorkerCheckWS.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorkerCheckWS_RunWorkerCompleted);

            timerWS.Tick += new EventHandler(timerWS_Tick);

            timerWS.Start();
        }

        void timerWS_Tick(object sender, EventArgs e)
        {
            if (!backgroundWorkerCheckWS.IsBusy)
                backgroundWorkerCheckWS.RunWorkerAsync();
        }

        void backgroundWorkerCheckWS_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            textBox1.Text += "Just Checked Web Service" + System.Environment.NewLine + System.Environment.NewLine;
        }

        void backgroundWorkerCheckWS_DoWork(object sender, DoWorkEventArgs e)
        {
            //some WS stuff
            for (int i = 0; i < 10000; i++)
                System.Math.Asin(((double)i));
        }
    }
}